﻿@model GosWeb.Models.Db.Biont
@using GosWeb.Models.Db
@using GosWeb.Biz
@{
    Layout = null;
    string gRatioStyle=string.Empty;
    Biont self = Model as Biont;
        
}
<!DOCTYPE html>
<html>
<head>
    <title>个体档案证明: @self.GetLongID()</title>
    <style type="text/css">
        .display-field
        {
            color: black;
            border-bottom-width:1px;
            border-bottom-style:solid;
            border-bottom-color:Blue;
        }
        a
        {
            color:Black;
            border-bottom-width:0px;
        }
    </style>
</head>
<body  style="margin:1;padding:1;width:800">
    @{

        Biont ancestor_1 = null, ancestor_2 = null, ancestor_1_1 = null, ancestor_1_2 = null, ancestor_1_1_1 = null, ancestor_1_1_2 = null, ancestor_1_2_1 = null, ancestor_1_2_2 = null,
            ancestor_2_1 = null, ancestor_2_2 = null, ancestor_2_1_1 = null, ancestor_2_1_2 = null, ancestor_2_2_1 = null, ancestor_2_2_2 = null;
        // Biont 
        if (self == null)
        {
            Html.Label("不存在祖先！可能此ID不存在或是始祖", "出错啦:");
        }
        else
        {
            gRatioStyle = "style =\"color:Green\"";
            if (Model.IsGeneRatioCompletion() == false)
            {
                gRatioStyle = "style =\"color:Red\"";
            } 
            //---------------
            
            BiontBiz bb = BiontBiz.GetInstance();
            ancestor_1 = bb.FindBiont(self.FatherID);
            if (ancestor_1 is Biont)
            {
                ancestor_1_1 = (ancestor_1 as Biont).GetFather();
                if (ancestor_1_1 is Biont)
                {
                    ancestor_1_1_1 = (ancestor_1_1 as Biont).GetFather();
                    ancestor_1_1_2 = (ancestor_1_1 as Biont).GetMother();
                }
                ancestor_1_2 = (ancestor_1 as Biont).GetMother();
                if (ancestor_1_2 is Biont)
                {
                    ancestor_1_2_1 = (ancestor_1_2 as Biont).GetFather();
                    ancestor_1_2_2 = (ancestor_1_2 as Biont).GetMother();
                }
            }

            ancestor_2 = bb.FindBiont(self.MotherID);
            if (ancestor_2 is Biont)
            {
                ancestor_2_1 = (ancestor_2 as Biont).GetFather();
                if (ancestor_2_1 is Biont)
                {
                    ancestor_2_1_1 = (ancestor_2_1 as Biont).GetFather();
                    ancestor_2_1_2 = (ancestor_2_1 as Biont).GetMother();
                }
                ancestor_2_2 = (ancestor_2 as Biont).GetMother();
                if (ancestor_2_2 is Biont)
                {
                    ancestor_2_2_1 = (ancestor_2_2 as Biont).GetFather();
                    ancestor_2_2_2 = (ancestor_2_2 as Biont).GetMother();
                }
            }
        }
        }
    <div style="font-size:large;text-align:center" ><b>种猪档案证明</b></div>
    <table>
        <tr>
            <td>
                <img width="220" alt="" src="../../Content/Pic/zhutou.png" />
            </td>
            <td>
                <fieldset>
                    <legend>个体详细资料 （Biont Detail Information) </legend>
                    <table style="border-width: 0px; border-color: Black; border-style: solid">
                        <tr>
                            <td class="display-label">
                              @Html.LabelFor(model => model.BiontID):
                            </td>
                            <td class="display-field">@Html.ActionLink(Model.BiontID, "Details", new { id = Model.BiontID })
                            </td>
                            <td class="display-label">
                             &nbsp   @Html.LabelFor(model => model.Sex):
                            </td>
                            <td class="display-field">@Model.SexStr
                            </td>
                            <td class="display-label">
                             &nbsp   @Html.LabelFor(model => model.LeftTitNumber):
                            </td>
                            <td class="display-field">@Model.LeftTitNumber
                            </td>
                            <td class="display-label" align="right">
                             &nbsp   @Html.LabelFor(model => model.RightTitNumber)   :
                            </td>
                            <td class="display-field">@Model.RightTitNumber
                            </td>
                        </tr>
                        <tr>
                            <td class="display-label">
                                @Html.LabelFor(model => model.Birthday):
                            </td>
                            <td class="display-field">@String.Format("{0:D}", Model.Birthday)
                            </td>
                            <td class="display-label">
                             &nbsp   @Html.LabelFor(model => model.GenesShortStr):
                            </td>
                            <td class="display-field">@Model.GenesShortStr
                            </td>
                            <td class="display-label">
                             &nbsp   @Html.LabelFor(model => model.NestNumber):
                            </td>
                            <td class="display-field">@Model.NestNumber
                            </td>  
                            <td class="display-label">
                             &nbsp   @Html.LabelFor(model => model.Weight):
                            </td>
                            <td class="display-field">@Model.Weight kg
                            </td> 
                        </tr>
                        <tr>
                            <td class="display-label">
                                ID号:
                            </td>
                            <td class="display-field" colspan="3">@Model.GetLongID()
                            </td>   
                            <td class="display-label" style="text-align:right">
                             &nbsp   @Html.LabelFor(model => model.Address.Site):
                            </td>
                            <td class="display-field" colspan="3">@BiontBiz.GetInstance().GetSiteString(Model.Address.Site)
                            </td>                           
                        </tr>
                        <tr>
                            <td class="display-field" colspan="8">
                                <span style="color: #666666;font-size:small">(ID编号说明:如"LD-XS-00001-04"，"LD"是品名，表示"长白杜洛克";<br />
                                    XS是猪场代号："雪山猪场";"00001-04"是耳缺号） </span>
                            </td>
                        </tr>
                    </table>
                    @Html.LabelFor(model => model.PubInfo):<br />
                    <pre style="width: 100%; white-space: pre-wrap;">@Model.PubInfo</pre>
                </fieldset>
            </td>
        </tr>
    </table>
    <hr />
    <div style="font-size: 12px; background-repeat: no-repeat; width: 500px; height: 600px">
        <img alt="" src="../../Content/Pic/PrintTree.png" style="position: absolute;" />
        <div style="position: absolute; padding-left: 8px; padding-top: 226px">
            <!-- 0 -->
            <b>@Html.Raw(BiontBiz.GetPrintDetailStr(self))</b>
        </div>
        <div style="position: absolute; padding-left: 95px; padding-top: 105px">
            <!-- 1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1))
        </div>
        <div style="position: absolute; padding-left: 95px; padding-top: 353px">
            <!--  2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2))
        </div>
        <div style="position: absolute; padding-left: 203px; padding-top: 48px">
            <!-- 1.1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_1))
        </div>
        <div style="position: absolute; padding-left: 203px; padding-top: 167px">
            <!-- 1.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_2))
        </div>
        <div style="position: absolute; padding-left: 203px; padding-top: 288px">
            <!--  2.1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_1))
        </div>
        <div style="position: absolute; padding-left: 203px; padding-top: 408px">
            <!--  2.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_2))
        </div>
        <div style="position: absolute; padding-left: 337px; padding-top: 10px">
            <!-- 1.1.1 --> 
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_1_1))
        </div>
        <div style="position: absolute; padding-left: 337px; padding-top: 83px">
            <!-- 1.1.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_1_2))
        </div>
        <div style="position: absolute; padding-left: 337px; padding-top: 130px">
            <!-- 1.2.1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_2_1))
        </div>
        <div style="position: absolute; padding-left: 337px; padding-top: 205px">
            <!-- 1.2.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_2_2))
        </div>
        <div style="position: absolute; padding-left: 337px; padding-top: 249px">
            <!-- 2.1.1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_1_1))
        </div>
        <div style="position: absolute; padding-left: 337px; padding-top: 325px">
            <!--  2.1.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_1_2))
        </div>
        <div style="position: absolute; padding-left: 337px; padding-top: 369px">
            <!--  2.2.1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_2_1))
        </div>
        <div style="position: absolute; padding-left: 337px; padding-top: 444px">
            <!--  2.2.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_2_2))
        </div>
    </div>
</body>
</html>
